package com.aurora.source.authority.presenter;

import android.content.Context;

import com.aurora.source.authority.view.IExamineView;
import com.aurora.source.base.BaseBean;
import com.aurora.source.base.BasePresenter;
import com.aurora.source.constant.AuroraConstants;
import com.aurora.source.source.bean.UserInfoBean;
import com.aurora.source.util.netutil.SubscriberObserver;

import java.util.Map;

public class ExaminePresenter extends BasePresenter<IExamineView> {
    public ExaminePresenter(IExamineView baseView) {
        super(baseView);
    }

    public void Examine(Context context, Map<String, String> params, boolean isShowDialog) {
        requestMethod.examine(params, new SubscriberObserver<BaseBean<UserInfoBean>>(context,isShowDialog) {
            @Override
            public void onSuccess(BaseBean<UserInfoBean> examineBeanBaseBean) {
                if (examineBeanBaseBean.getCode().equals(AuroraConstants.REQUEST_SUCCESS)) {
                    baseView.onExamineSuccess(examineBeanBaseBean.getData());
                } else {
                    baseView.onExamineFail(examineBeanBaseBean.getMsg());
                }
            }

            @Override
            public void onError(String msg) {
                baseView.onExamineFail(msg);
            }

            @Override
            public void onFinish() {

            }
        });
    }
}
